/*
 * @(#)a.java Jan 19, 2012 - 7:24:10 PM
 * 
 * Copyright 2011 Cin/UFPE/VSPEED
 */
package br.ufpe.cin.vspeed.gui.render;

import java.awt.Component;

import javax.swing.JButton;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.table.TableCellRenderer;

import br.ufpe.cin.vspeed.gui.GUIConstants;

/**
 * @author <a href="mailto:andreza.lba@gmail.com">Andreza Leite de Alencar</a>
 */
public class CellRenderInstanceInformation extends JButton implements TableCellRenderer {
	private static final long serialVersionUID = -1817154601280191964L;

	public CellRenderInstanceInformation() {
		setToolTipText("Result information");
	}

	@Override
	public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected,
			final boolean hasFocus, final int row, final int column) {
		if (isSelected) {
			setForeground(table.getSelectionForeground());
			setBackground(table.getSelectionBackground());
		} else {
			setForeground(table.getForeground());
			setBackground(UIManager.getColor("Button.background"));
		}
		setIcon(GUIConstants.Images.INFO_ICON);
		setText((value == null) ? "" : value.toString());

		return this;
	}
}
